﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:l="http://wpflocalizeextension.codeplex.com"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Controls.Common="clr-namespace:Imagin.Controls.Common;assembly=Imagin.Controls.Common"
    xmlns:Controls.Common.Extensions="clr-namespace:Imagin.Controls.Common.Extensions;assembly=Imagin.Controls.Common"
    xmlns:Controls.Extended="clr-namespace:Imagin.Controls.Extended;assembly=Imagin.Controls.Extended"
    xmlns:Common.Extensions="clr-namespace:Imagin.Common.Extensions;assembly=Imagin.Common">
    <!-- ............................................... Buttons -->
    
    <Style x:Key="Style.Window.Button" TargetType="Button">
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Height" Value="25" />
        <Setter Property="Width" Value="30" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Border
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}">
                        <Controls.Common:MaskedImage 
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            ImageColor="{TemplateBinding Foreground}"
                            Source="{Binding Content, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}, UpdateSourceTrigger=PropertyChanged}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="False">
                <Setter Property="Background" Value="{DynamicResource Brush.Window.Button.Background}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource Brush.Window.Button.Border}"/>
                <Setter Property="Foreground" Value="{DynamicResource Brush.Window.Button.Foreground}" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource Brush.Window.Button.MouseOver.Background}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource Brush.Window.Button.MouseOver.Border}"/>
                <Setter Property="Foreground" Value="{DynamicResource Brush.Window.Button.MouseOver.Foreground}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background" Value="{DynamicResource Brush.Window.Button.Pressed.Background}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource Brush.Window.Button.Pressed.Border}"/>
                <Setter Property="Foreground" Value="{DynamicResource Brush.Window.Button.Pressed.Foreground}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <!-- ............................................... Parts -->

    <Style x:Key="{x:Type Controls.Common:WindowFooter}" TargetType="{x:Type Controls.Common:WindowFooter}">
        <Setter Property="Background" Value="{DynamicResource Brush.WindowFooter.Background}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource Brush.Border}"/>
        <Setter Property="BorderThickness" Value="0,1,0,0"/>
        <Setter Property="Foreground" Value="{DynamicResource Brush.WindowFooter.Foreground}"/>
        <Setter Property="Height" Value="35"/>
        <Setter Property="Margin" Value="0,5,0,0"/>
    </Style>

    <!-- ............................................... Windows -->

    <Style x:Key="Style.Window" TargetType="{x:Type Window}">
        <Setter Property="Background" Value="{DynamicResource Brush.Window.Background}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource Brush.Window.Border}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
        <Setter Property="UseLayoutRounding" Value="True" />
        <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
        <Setter Property="Padding" Value="10"/>
        <Setter Property="ShowInTaskbar" Value="True" />
        <Style.Triggers>
            <Trigger Property="IsActive" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource Brush.Window.Active.Border}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="Style.BasicWindow" TargetType="{x:Type Controls.Common:BasicWindow}" BasedOn="{StaticResource Style.Window}">
        <Setter Property="ContentBorderBrush" Value="{DynamicResource Brush.Window.Content.Border}"/>
        <Style.Triggers>
            <Trigger Property="Controls.Common:BasicWindow.Type" Value="Window">
                <Setter Property="ContentBorderThickness" Value="1"/>
                <Setter Property="ContentMargin" Value="5,0,5,5"/>
            </Trigger>
            <Trigger Property="Controls.Common:BasicWindow.Type" Value="Tool">
                <Setter Property="ContentBorderThickness" Value="0,1,0,0"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Type Controls.Common:BasicWindow}" TargetType="{x:Type Controls.Common:BasicWindow}" BasedOn="{StaticResource Style.BasicWindow}"/>

    <Style x:Key="{x:Type Controls.Common:Gadget}" TargetType="{x:Type Controls.Common:Gadget}" BasedOn="{StaticResource Style.Window}">
        <Setter Property="Padding" Value="0"/>
    </Style>

    <!-- ............................................... Dialogs -->

    <Style x:Key="Style.BrushDialog.Footer" TargetType="Border">
        <Setter Property="Background" Value="#05000000"/>
        <Setter Property="BorderBrush" Value="#15000000"/>
        <Setter Property="BorderThickness" Value="0,1,0,0"/>
        <Setter Property="Margin" Value="-10,10,-10,0"/>
        <Setter Property="Padding" Value="7"/>
    </Style>
    
    <Style x:Key="Style.BrushDialog" TargetType="{x:Type Controls.Common:BasicWindow}" BasedOn="{StaticResource Style.BasicWindow}">
        <Setter Property="Padding" Value="10,10,10,0"/>
    </Style>

    <Style x:Key="{x:Type Controls.Extended:ColorDialog}" TargetType="{x:Type Controls.Extended:ColorDialog}" BasedOn="{StaticResource Style.BrushDialog}">
        <Setter Property="FooterStyle" Value="{StaticResource Style.BrushDialog.Footer}"/>
    </Style>

    <Style x:Key="{x:Type Controls.Extended:GradientDialog}" TargetType="{x:Type Controls.Extended:GradientDialog}" BasedOn="{StaticResource Style.BrushDialog}">
        <Setter Property="FooterStyle" Value="{StaticResource Style.BrushDialog.Footer}"/>
    </Style>
</ResourceDictionary>